#ifndef LOG_H
#define LOG_H

#include <Arduino.h>
#include "os_sprintf.h"

//#define NDEBUG 1

#ifndef NDEBUG
struct log_buf
{
    char* buffer[0];
};
#endif

struct log{
#ifndef NDEBUG
static void out(char character, void* buffer, unsigned int idx, unsigned int maxlen)
{
    Serial.print(character);
}
#endif
static void debug(const char* fmt,...)
{
    #ifndef NDEBUG
    static log_buf buf;
    va_list args;
    va_start(args, fmt);
    os_vsnprintf(out,buf.buffer,255,fmt, args);
    va_end(args);
    #endif
}
};

#endif